const { defineConfig } = require('@vue/cli-service')
let proxyObj = {}

proxyObj['/']={
  //websocket
  ws:false,
  //目标地址
  target:'http://localhost:8082',
  //发送请求头host会被设置成target
  changeOrigin:true,
  //不重写请求路径
  pathReWrite:{
    '^/':'/'
  }
}

proxyObj['/ws'] = {
  ws:true,
  target: 'ws://localhost:8081'
}
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false,
  // build时构建文件的目录 构建时传入 --no-clean 可关闭该行为
  outputDir: 'dist',
  // build时放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
  assetsDir: 'assets',
  indexPath: 'index.html',
  publicPath: './',
  devServer:{
    host:'localhost',
    port:8080,
    proxy:proxyObj
  },
  configureWebpack: {
    devtool: "source-map",
    resolve: {
      fallback: {
       /* util: require.resolve("util/"),
        path: require.resolve("path-browserify"),
        assert: require.resolve("assert/"),
        url: require.resolve("url/"),
        fs: 'empty'*/
        util: false,
        path: false,
        assert: false,
        url: false,


      },
    },
  },


})
